<%@page import="com.hospital.model.Cure"%>
<%@page import="com.hospital.dao.CureDAO"%>
<%@page import="java.util.List"%>
<%@page import="com.hospital.util.DateUtil"%>
<%@page import="com.hospital.util.DbUtil"%>
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>医院管理系统</title>
<link href="images/main.css" rel="stylesheet" type="text/css" />
<link  href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/trim.js"></script>
<script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
</head>
<body onload="init();">
	<jsp:include page="right_top.jsp"></jsp:include>
	<!-- TOP START -->
	<div id="right_font">
		<img src="images/main_14.gif" /> 您现在所在的位置：首页 → 票务信息管理 → <span
			class="bfont">票务信息打印</span>
	</div>
	<!-- TOP END -->
	<hr >
	<form action="" method="post" name="form" id="form">
	<table style="margin-top: 30px; margin-left:50px;" cellpadding="0" border="0" width="40%">
			<tr height="30px;">
				<td colspan="2" align="center" style="font-size:30px;">
					医疗机构门诊清单
				</td>
			</tr>
		</table>
		<table style="margin-top: 30px; margin-left:50px;" cellpadding="0" cellspacing="0" border="1" width="40%">
		<tr height="30px;" align="center">
			<th><font color="#FF0000"></font>姓名</th>
		</tr>
		<% 
			int id = Integer.parseInt(request.getParameter("id"));
			String sql = "select * from t_cure where id = " + id;
			Map<String, Object> map  = (Map<String, Object>)DbUtil.find(sql).get(0);
			String sql_name = "select name from t_order where oid = '" + map.get("orderid") + "'";
			String name = DbUtil.getString(sql_name);
			String sql_user = "select * from t_user_info where account = '" + name + "'";
			String sql_sex = "select sex from t_user_info where account = '" + name + "'";
			String sex = DbUtil.getString(sql_sex);
			List<Map<String, Object>> list2 = DbUtil.find(sql_user);
			for(int i = 0;i < list2.size();i++){
				Map<String, Object> map2  = list2.get(i);
			}
		%>
		<tr height="30px;" align="center">
			<th><font color="#FF0000"></font><%=name %></th>
		</tr>
		</table>
		<table style="margin-top: 30px; margin-left:50px;" cellpadding="0" cellspacing="0" border="1" width="40%">
			<tr height="30px;" align="center">
				<th>药品</th>
				<th>价格(单位：元)</th>
				<th>检查项目</th>
				<th>检查费用(单位：元)</th>
			</tr>
		<% 
			double temp = 0;
			List<Cure> list = new CureDAO().find(name);
			for(int i = 0; i < list.size(); i++){
				temp += list.get(i).getDrugmoney() + list.get(i).getItemmoney();
		%>	
			<tr height="30px;" align="center">
				<td><%=list.get(i).getDrug() %></td>
				<td><%=list.get(i).getDrugmoney() %></td>
				<%
					String sql_item = "select name from t_checklist where id = '" + list.get(i).getItem() + "'";
					String item = DbUtil.getString(sql_item); 
				%>
				<td><%=item%></td>
				<td><%=list.get(i).getItemmoney() %></td>
			</tr>
		<% 
			}
		%>	
			<tr height="30px;" align="center">
				<th colspan="3">总额(单位：元)</th>
				<td><%=temp %></td>
			</tr>
		</table>		
		<table style="margin-top: 30px; margin-left:50px;" cellpadding="0" cellspacing="0" border="0" width="40%">
			<tr height="30px;">
				<td colspan="2" align="center">
					<input type="button" value="打印" onclick="window.print();"/>&nbsp;&nbsp;
				</td>
			</tr>
		</table>
	</form>
</body>
</html>